package com.atguigu.zy.interview.juc.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author : Jungle
 * @Description : 应用，本地数据库
 * @Data 不能用在枚举上
 */
@AllArgsConstructor
@Getter
public enum CountryEnum {
    ONE(1, "齐"),
    TWO(2, "楚"),
    THREE(3, "燕"),
    FOUR(4, "赵"),
    FIVE(5, "魏"),
    SIX(6, "韩");

    private Integer retCode;
    private String retMsg;

    /**
     * 枚举自带转数组的方法
     */
    public static CountryEnum forEach_CountryEnum(int index) {
        CountryEnum[] elements = CountryEnum.values();
        for (CountryEnum element : elements) {
            if (index == element.retCode) {
                return element;
            }
        }
        return null;
    }
}



/*    mysql dbName = countryEnumtable
one
ID userName age birth userEmail1齐
109
ONE(1,"齐”, v2,v3,v4,v5)*/

